#ifndef PERSONALWIDGET_H
#define PERSONALWIDGET_H

#include <Wt/Chart/WCartesianChart>
#include <QVector>
#include <QSharedPointer>


#include "User.h"
#include "DbSession.h"
#include "PlanWidget.h"


namespace Wt {
  class WString;
  class WWidget;
  class WText;
  class WAbstractItemModel;
  class WContainerWidget;
}

using namespace Wt;


class PersonalWidget : public WContainerWidget
{
private:
   bool other;
   WContainerWidget *w;
   WTabWidget *tabmenu;
   WLineEdit *WeightEdit;
   WAbstractItemModel *model;
   WText *CurWeight;
   Wt::Chart::WCartesianChart *WeightChart;
   WWidget *WeightWidg;
   WMenuItem *WeightTab;
   int UserId;
   DbSession& Db;
   QSharedPointer<User> UserObject;
   QSharedPointer<QVector<QSharedPointer<Weight> > > UserWeights;
   QVector<WCheckBox*> CheckBoxList;
   QSharedPointer<QVector<QSharedPointer<User> > > Users;

   WAbstractItemModel *MakeModel(WContainerWidget *parent,QDate begin,QDate end);
   Wt::Chart::WCartesianChart *MakeChart(WContainerWidget *parent);

   PlanWidget *dietPlanWidget;
   PlanWidget *fitnessPlanWidget;

   WDatePicker *wdp1;
   WDatePicker *wdp2;


   void addWeight();
   void UpdateChart();
   void AddDataSeriesOnChart(Wt::Chart::WCartesianChart *Chart);

public:
     PersonalWidget(int id,WApplication *app, bool other = false, int guestId = 0);
     virtual ~PersonalWidget();
     WWidget *WeightWidget();

};

#endif
